{**
 * Copyright (c) 2003-2012 John Willinsky 
 * Copyright (c) 2014-2023 Ngoc Diep
 *}


 <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset={$defaultCharset|escape}" />
	<link rel="stylesheet" href="{$baseUrl}/lib/pkp/styles/pkp.css" type="text/css" />
	<link rel="stylesheet" href="{$baseUrl}/lib/pkp/styles/common.css" type="text/css" />
	<link rel="stylesheet" href="{$baseUrl}/styles/common.css" type="text/css" />
	<link rel="stylesheet" href="{$baseUrl}/styles/ctkho.css" type="text/css" />

	<!-- Base Jquery -->
	{*
	{if $allowCDN}<script type="text/javascript" src="http://www.google.com/jsapi"></script>
	<script type="text/javascript">{literal}
		// Provide a local fallback if the CDN cannot be reached
		if (typeof google == 'undefined') {
			document.write(unescape("%3Cscript src='{/literal}{$baseUrl}{literal}/lib/pkp/js/lib/jquery/jquery.min.js' type='text/javascript'%3E%3C/script%3E"));
			document.write(unescape("%3Cscript src='{/literal}{$baseUrl}{literal}/lib/pkp/js/lib/jquery/plugins/jqueryUi.min.js' type='text/javascript'%3E%3C/script%3E"));
		} else {
			google.load("jquery", "{/literal}{$smarty.const.CDN_JQUERY_VERSION}{literal}");
			google.load("jqueryui", "{/literal}{$smarty.const.CDN_JQUERY_UI_VERSION}{literal}");
		}
	{/literal}</script>
	{else}
	*}
	<script type="text/javascript" src="{$baseUrl}/lib/pkp/js/lib/jquery/jquery.min.js"></script>
	<script type="text/javascript" src="{$baseUrl}/lib/pkp/js/lib/jquery/plugins/jqueryUi.min.js"></script>
	{*{/if}
	*}

	<script type="text/javascript" src="{$baseUrl}/classes/acct/js/CNCTKHO.js"></script>
	<script type="text/javascript" src="{$baseUrl}/classes/acct/js/danhmucRF.js"></script>


</head>
{*
<body onload='javascript:document.getElementById("soct").focus();'>
*}

{strip}
{assign var="pageTitle" value="Hoa Don Ban Hang"}
{if ($loaitien) != 'VND' }
	{assign var="socot" value="6"}
{else}
	{assign var="socot" value="5"}
{/if}
<div id="header" >
<div id="headerTitle">
<h1  >

{if $displayPageHeaderLogo && is_array($displayPageHeaderLogo)}
	<img src="{$publicFilesDir}/{$displayPageHeaderLogo.uploadName|escape:"url"}" width="{$displayPageHeaderLogo.width|escape}" height="{$displayPageHeaderLogo.height|escape}" {if $displayPageHeaderLogoAltText != ''}alt="{$displayPageHeaderLogoAltText|escape}"{else}alt="{translate key="common.pageHeaderLogo.altText"}"{/if} />
{/if}
{if $displayPageHeaderTitle && is_array($displayPageHeaderTitle)}
	<img src="{$publicFilesDir}/{$displayPageHeaderTitle.uploadName|escape:"url"}" width="{$displayPageHeaderTitle.width|escape}" height="{$displayPageHeaderTitle.height|escape}" {if $displayPageHeaderTitleAltText != ''}alt="{$displayPageHeaderTitleAltText|escape}"{else}alt="{translate key="common.pageHeader.altText"}"{/if} />
{elseif $displayPageHeaderTitle}
	{$displayPageHeaderTitle}
{elseif $alternatePageHeader}
	{$alternatePageHeader}
{elseif $siteTitle}
	{$siteTitle}
{else}
	{$applicationName}
{/if}

</h1>
</div>
</div>
{include file="acct/acctNavbar.tpl"}
{include file="acct/breadcrumbs.tpl"}

{/strip}

{if ($Mode) == 'edit' }
	<body onload="LoadForm_edit('{$sodong}', '{$tknoss}', '{$tkcoss}', '{$macttknoss}', '{$macttkcoss}', '{$sotienvnss}','{$diengiaiss}', '{$urlS_getTenDMTK}', '{$urlS_getTenDMDV}')">
	{assign var="ngct" value=$ngct|date_format:"%d/%m/%Y"}

{else}
	<body onload="LoadForm_add('{$sodong}', '{$madvs}')">
	{assign var="ngct" value=$smarty.now|date_format:"%d/%m/%Y"}
{/if}



<div id = "ttChiTiet" style="display:none" >{$ChiTiet}</div>
<div id = "ttNam" style="display:none">{$xNam}</div>
<div id = "idPhieu" ></div>

{strip}
{include file="acctCN/RSBar.tpl"}
{/strip}


<div style="width: 100%">
<table id="head1" width="70%">
<tr>
<th></th>
<th></th>
</tr>
<tr valign="bottom">
<td bgcolor='#ffffff' background='img/strichel.gif' colspan=2></td>
</tr>
<tr rowspan= "2" style="valign:top; margin-top:0">
	<td width="35%" valign="top" text-align= "center" rowspan = "2"><b>{$action}</b> <div id="idphieu" style="display:none"></div>
	<hr size="2" noshade style="color:#000000" align="left" />
	<input type="button" id="save" value="{translate key="common.save"}"  class="button" onClick="InsCT('close', '{$journalid}', '{$xNam}', '{$idphieu}', '{$urlIns}');"> 

	<input type="button" id="edit" value="Sửa"  class="button" disabled="disabled"  onClick="Edit_CTKHO();"> 
	<input type="button" id="dele" value="Xóa"  class="button" disabled="disabled"  onClick="Dele_CTKHO('{$journalid}', '{$xNam}', '{$idphieu}', '{$urlDel}');"> 
	
	
	{if isset($soct)}
		<input type="button" class="button" value="{translate key="common.cancel"}" class="button" onclick="refurl('{$urlMain}')" />
	{else}
		<input id="cancel" type="button" class="button" value="{translate key="common.cancel"}" class="button" />
	{/if}
	
	</td>

	<td width="65%"><div class="DMtitle" style = "valign: center; text-align: center; text-transform: uppercase "><strong>{$loaiphieu} <br> N. {$xNam}</strong></div></td>

</tr>
<tr valign="bottom">
<td bgcolor='#ffffff' background='img/strichel.gif' colspan=2></td>
</tr>
</table>

</div>


<form name="CTTMTG" id="CTTMTG" method="post" action="{url nam= $xNam  EditMode = "save" }" onsubmit="return false;">
<div style="width: 100%; border: thin solid #DDDDD0; border-left: none; background-color: 'ivory 3'  ">
{*
<table id="head2" style="float:right; margin-right:10px; width:30%; align:left; border:1px dotted #6E7FC9">
<thead>
<tr height = "40" class="myheaderrowDK">
<th width = "30%"  name="BBB" >Định khoản </th>
<th width = "30%" name="sotien"  >Số tiền</th>
<th width = "20%" name="tkno"  >TK Nợ </th>
<th width = "20%" name="tkco" >TK Có</th>
</tr>
<tr >
</tr>
</thead>
<tr class="mydatarowDK" rowspan = "2">
<td class="value" style= "vertical-align: top;">
Giá vốn
</td>
<td valign="top" class="value">
<input type="text" name="dk" value="{$dk}" id="dk" style="width:95%" class="textField" />
</td>

<td valign="top" class="value">
<input type="text" name="tkno" value="{$tkno}" id="tkno" style="width:95%" class="textField" />
</td>
<td valign="top" class="value">
<input type="text" name="tkco" value="{$tkco}" id="tkco" style="width:95%" class="textField" />
</td>
</tr>
<tr class="mydatarowDK" rowspan = "2">
<td class="value" style= "vertical-align: top;">
Doanh thu
</td>
<td valign="top" class="value">
<input type="text" name="dk" value="{$dk}" id="dk" style="width:95%" class="textField" />
</td>

<td valign="top" class="value">
<input type="text" name="tkno" value="{$tkno}" id="tkno" style="width:95%" class="textField" />
</td>
<td valign="top" class="value">
<input type="text" name="tkco" value="{$tkco}" id="tkco" style="width:95%" class="textField" />
</td>
</tr>
<tr class="mydatarowDK" rowspan = "2">
<td class="value" style= "vertical-align: top;">
Chiết khấu
</td>
<td valign="top" class="value">
<input type="text" name="dk" value="{$dk}" id="dk" style="width:95%" class="textField" />
</td>

<td valign="top" class="value">
<input type="text" name="tkno" value="{$tkno}" id="tkno" style="width:95%" class="textField" />
</td>
<td valign="top" class="value">
<input type="text" name="tkco" value="{$tkco}" id="tkco" style="width:95%" class="textField" />
</td>
</tr>
<tr class="mydatarowDK" rowspan = "2">
<td class="value" style= "vertical-align: top;">
Thuế
</td>
<td valign="top" class="value">
<input type="text" name="dk" value="{$dk}" id="dk" style="width:95%" class="textField" />
</td>

<td valign="top" class="value">
<input type="text" name="tkno" value="{$tkno}" id="tkno" style="width:95%" class="textField" />
</td>
<td valign="top" class="value">
<input type="text" name="tkco" value="{$tkco}" id="tkco" style="width:95%" class="textField" />
</td>
</tr>






</table>
*}


<table id= "mymain"  width="70%" align = "left" cellspacing="0" style = "border-collapse:separate; border-spacing:.5em;" >
<tr valign="top" height= "10px">
	<td width="10%" ></td>
	<td width="10%" ></td>
	<td width="5%" ></td>
	<td width="10%" ></td>
	<td width="10%"></td>
	<td width="10%"></td>
	<td width="10%"></td>
	<td width="10%"></td>
	<td width="10%"></td>
	<td width="10%"></td>
</tr>

<tr valign="center">
	<td colspan = "2"  align = "right"   class="mylabel" ><label for="soct">S&#7889; ch&#7913;ng t&#7915;:</label></td>
	<td colspan = "2" class="value" ><input type="text" name="soct" value="{$soct}" id="soct" style="width:99%" class="textField" onclick="SetCur(this.id)" /></td>

	<td colspan = "1"  align = "right"   class="mylabel" ><label for="sosr">S&#7889; Seri:</label></td>
	<td colspan = "2" class="value" ><input type="text" name="sosr" value="{$sosr}" id="sosr" style="width:70%" class="textField" onclick="SetCur(this.id)" /></td>

	<td colspan = "2"   align = "right"  class="mylabel"><label for="ngct">Ng&#224;y CT:</label></td>
	<td colspan = "2" class="value"><input type="text" class="textField" name="ngct" value="{$ngct}" id="ngct" size="10" maxlength="10"   onblur="return validNgay(this.value, this.id, '{$xNam}')" onkeydown="javascript:if (event.keyCode == 13) document.getElementById('hoten').focus()" class="textField" onclick="SetCur(this.id)" /></td>
	<td colspan = "1"></td>
</tr>

<tr valign="top">
	<td colspan = "2"  align = "right"   class="label"><label for="lydo">Nội dung:</label></td>
	<td colspan = "5" class="value"><input type="text" name="diengiai" value="{$diengiai}" id="diengiai" class="textField" style="width:99%" onclick="SetCur(this.id)" /></td>
	<td colspan = "2"  align = "right"   class="label"><label for="makhox">Kho xuất:</label></td>
	<td colspan = "7" class="value">
	<select name="makhox" value="{$makhox}" id="makhox" class="makho">
	{html_options id="makhox" options=$makhoa selected=$ma_khox}
	</select>
	<div style="display: inline"  class="selectMenu" style="font-size:11px" ></div>
	</td>
</tr>

<tr valign="top">
	<td colspan = "2"  align = "right"   class="label"><label for="cttkno">Mã Đơn vị:</label></td>
	<td colspan = "2" class="value"><div id = "cbdmdv"></div>
	<select name="madvno" value="{$madvno}" id="madvno" onclick="SetCur(this.id)" onChange="changeMaCTTK(this.id, '{$urlS_getTenDMDV}');" class="selectMenu">
		{html_options options=$madva|truncate:40 selected=""}
	</select>
	</td>
	<td colspan = "3" class="value">
	<input type="text" name="tendvno" value="{$tendvno}" id="tendvno" disabled="disabled" style="width:99%" class="textField" onclick="SetCur(this.id)" />

	</td>
		
	<td colspan = "2"  align = "right"   class="mylabel" ><label for="sosr">MS Thuế:</label></td>
	<td colspan = "2" class="value" ><input type="text" name="msthueno" value="{$msthueno}" id="msthueno" disabled="disabled" style="width:95%" class="textField" onclick="SetCur(this.id)" /></td>
</tr>
<tr valign="center">
	<td colspan = "2"  align = "right"   class="mylabel" ><label for="diachino">Địa chỉ:</label></td>
	<td colspan = "9" class="value" ><input  type="text" name="diachino" value="{$diachino}" id="diachino"  disabled="disabled" style="width:90%" class="textField" onclick="SetCur(this.id)" /></td>
</tr>


<tr valign="center">
	<td colspan = "2"  align = "right"   class="label"><label for="matkcn">TKNợ(CNợ):</label></td>
	<td colspan = "8" class="value">
	

	<select name="tk_dv"  value="{$tk_dv}" id="tk_dv" class="selectMenu" onclick="SetCur(this.id)" onChange="changeMa(this.id, '{$urlS_getTenDMTK}');">
	{html_options options=$matka|truncate:60 selected=$tk_dv}
	</select>
	</td>

</tr>

<tr valign="center">
	<td colspan = "2"  align = "right"   class="label"><label for="matkcn">TKCó(Thuế):</label></td>
	<td colspan = "5" class="value">
	<select name="tk_thue"  id="tk_thue" class="selectMenu" onclick="SetCur(this.id)" onChange="changeMa(this.id, '{$urlS_getTenDMTK}');">
	{html_options options=$matka|truncate:60 selected=$tk_thue}
	</select>
	</td>
	<td colspan = "2"  align = "right"   class="mylabel" ><label>TS VAT(%):</label></td>
	<td colspan = "3" class="value" ><input  type="text" name="TSVAT" value="{$tsvat}" id="tsvat"  style="width:70%" class="textField" onclick="SetCur(this.id)" /></td>
</tr>


<tr valign="top" height = "15px">
	
</tr>

</table>
</div>

<div>


<table id="myDetail" class = "listing" style="width: 100%; margin: 0 auto">
<thead>
<tr height = "40" class="myheaderrow">
<th width="37%" name="mavt" >Vật tư - Hàng hóa/Số lô/Hạn dùng</th>
<th width="10%" style="display:none;" name="solo" ></th>
<th width="10%" style="display:none;" name="handung" ></th>
<th width="5%" name="so_sl"  >Số lượng</th>
<th width="5%" name="so_dgb" >Đơn giá bán</th>
<th width="7%" name="so_sotienvnb"  >Số tiền</th>
<th width="5%" name="so_tlck" >TL CKhấu(%)</th>
<th width="5%" name="tk_ck"  >TK Nợ (Chiết khấu)</th>
<th width="5%" name="tk_dt" >TK Có(Doanh thu)</th>
<th width="5%" name="BBB" align="right">{translate key="common.action"}</th>
	
</tr>
<tr >
</tr>
</thead>


<tr class="mydatarow" rowspan = "2">
<td class="value" style= "vertical-align: top;">
<select name="mavt" value="{$mavt0}" id="mavt-1" onclick="SetCur(this.id)"  onChange="changeMaVT(this.id, '{$urlS_getTenDMVT}');" class="mavt">
	{html_options options=$mavta|truncate:50 selected=""}
</select>
<input type="text" size = "15" name="solo" value="{$solo0}" id="solo-1" style="text-align:center"  class="textField" onclick="SetCur(this.id)"/>

<input class="textField"  type="text" size = "10" name="handung" value="{$handung0}" id="fNgay1"  onfocus="(this).datepicker()" style="text-align:right" onclick="SetCur(this.id)" />
<div  class="selectMenu" style="font-size:11px" ></div>

</td>

<td valign="top" class="value"><input type="text" size="10" name="sl" value="" id="sl-1" style="text-align:right"   onclick="SetCur(this.id)" onblur="return validSL(this.value, this.id)" onkeypress="return isNumberKey(event)" class="textField" /></td>

<td valign="top" class="value"><input type="text" size="10" name="dgb" value="" id="dgb-1" style="text-align:right"   onclick="SetCur(this.id)" onblur="return validSL(this.value, this.id)" onkeypress="return isNumberKey(event)" class="textField" /></td>


<td valign="top" class="value"><input type="text" size="15" name="sotienvnb" value="{$sotienvnb0}" id="sotienvnb-1" style="text-align:right"   onblur="return validSoTienVNb(this.value, this.id,3)" onkeypress="return isNumberKey(event)" class="textField" onclick="SetCur(this.id)" /></td>

<td valign="top" class="value"><input type="text" size="5" name="tlck-1" value="{$tlck0}" id="tlck-1" style="text-align:right" class="textField" onkeypress="return isNumberKey(event)" onclick="SetCur(this.id)"/></td>

<td valign="top" class="value"><input type="text" size="10" name="tk_ck-1" value="{$tk_ck0}" id="tk_ck-1" style="text-align:right" class="textField" onclick="SetCur(this.id)" /></td>


<td valign="top" class="value"><input type="text" size="10" name="tk_dt-1" value="{$tk_dt0}" id="tk_dt-1" style="text-align:right" onclick="SetCur(this.id)"   class="textField" /></td>



<td valign="top" id = 'mytd'>
<a class="actiondelrow" style="color: black;"  id = "rowdel-1" href="javascript:void(0);" onclick="delerow(this.id,2, -1,0);">-X&#243;a d&#242;ng</a>  
</td>

</tr>

</table>

<table id="myTotal" width = "95%"  style = "margin: 0 auto">
<tr height = "40" valign="center" >
{if ($loaitien) != 'VND' }
	<td width = "10%" style = "font-weight: bold; text-align:left; vertical-align: middle;">
	<a class="action" href="javascript:void(0);" onclick="tinhtongAll(null,2, 0,1,'');">+Tinh lai </a></td>
	<td width = "10%" style = "font-weight: bold; text-align:left; vertical-align: middle;">T&#7893;ng c&#7897;ng:</td>

	<td width = "20%" style = "font-weight: bold; vertical-align: middle;"><label id = "totalNT"></label><u>&nbsp &nbsp </u>{$loaitien}</td>
{else}
	<td width = "10%" style = "font-weight: bold; text-align:left; vertical-align: middle;" width = "10%">T&#7893;ng c&#7897;ng:</td>

{/if}

<td width = "20%" style = "font-weight: bold; vertical-align: middle;"  ><label id = "total"></label><u>&nbsp &nbsp </u>VND </td>
<td width = "20%" align = "right">
<a class="action" href="javascript:void(0);" onclick="addnewrow_add();">+Th&#234;m d&#242;ng</a> 
</td>
</td>
</tr>
</table>
</div>


</form>

<div>
{strip}
{include file="acctCN/.tpl"}
{/strip}
</div>

</body>
</html>

	
